Framework

Physical object in the game world.

Entities are physical representations of objects in the game world. Lilia extends the functionality of entities to interface between Lilia's own classes, and to reduce boilerplate code.

See the Garry's Mod Wiki for all other methods that the Player class has.

Functions

entityMeta:assignCreator(client)

Assigns a creator to the entity.

Parameters

  • client Player

    The player to assign as the creator of the entity.

entityMeta:canSeeEntity(entity)

Checks if the entity can see another entity.

Parameters

  • entity Entity

    The entity to check visibility against.

Returns

  • bool

    True if the entity can see the target entity, false otherwise.

entityMeta:clearNetVars(receiver)

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

Clears all of the networked variables.

Parameters

  • receiver Table default: nil

    The players to clear the networked variable for

entityMeta:getEntItemDropPos()

Retrieves the drop position for an item associated with the entity.

Returns

  • Vector

    The drop position for the item.

entityMeta:getNetVar(key, default)

Retrieves a networked variable. If it is not set, it'll return the default that you've specified.

Parameters

  • key String

    Identifier of the networked variable

  • default

    Default value to return if the networked variable is not set

Returns

  • any

    value associated with the key, or the default that was given if it doesn't exist

Example Usage

print(client:getNetVar("example"))
 > Hello World!

See Also

entityMeta:getNetVar(key, default)

Retrieves the value of a networked variable associated with the entity.

Parameters

  • key String

    The identifier of the networked variable.

  • default

    The default value to return if the networked variable does not exist.

Returns

  • any

    The value of the networked variable, or the default value if it doesn't exist.

entityMeta:getViewAngle(pos)

Gets the view angle between the entity and a specified position.

Parameters

  • pos Vector

    The position to calculate the view angle towards.

Returns

  • number

    The view angle in degrees.

entityMeta:inFov(entity, fov)

Checks if the entity is within the field of view of another entity.

Parameters

  • entity Entity

    The entity to check the field of view against.

  • fov number default: 88

    The field of view angle in degrees.

Returns

  • bool

    True if the entity is within the field of view, false otherwise.

entityMeta:inTrace(entity)

Checks if the entity is in line of sight of another entity.

Parameters

  • entity Entity

    The entity to check line of sight against.

Returns

  • bool

    True if the entity is in line of sight, false otherwise.

entityMeta:isChair()

Checks if the entity is a chair.

Returns

  • bool

    True if the entity is a chair, false otherwise.

entityMeta:isInRoom(target)

Checks if the entity is inside a room (i.e., not blocked by world geometry) with another target entity.

Parameters

  • target Entity

    The target entity to check for room visibility.

Returns

  • bool

    True if the entity is in the same room as the target entity, false otherwise.

entityMeta:isItem()

Checks if the entity is an item entity.

Returns

  • bool

    True if the entity is an item entity, false otherwise.

entityMeta:isMoney()

Checks if the entity is a money entity.

Returns

  • bool

    True if the entity is a money entity, false otherwise.

entityMeta:isProp()

Checks if the entity is a physics prop.

Returns

  • bool

    True if the entity is a physics prop, false otherwise.

entityMeta:isScreenVisible(entity, maxDist, fov)

Checks if the entity has a clear line of sight to another entity and is within a specified distance and field of view angle.

Parameters

  • entity Entity

    The entity to check visibility against.

  • maxDist number default: 512^2

    The maximum distance squared within which the entity can see the other entity.

  • fov number default: 88

    The field of view angle in degrees.

Returns

  • bool

    True if the entity has a clear line of sight to the other entity within the specified distance and field of view angle, false otherwise.

entityMeta:isSimfphysCar()

Checks if the entity is a simfphys car.

Returns

  • bool

    True if the entity is a simfphys car, false otherwise.

entityMeta:nearEntity(radius)

Checks if there is an entity near the current entity within a specified radius.

Parameters

  • radius number default: 96

    The radius within which to check for nearby entities.

Returns

  • bool

    True if there is an entity nearby, false otherwise.

entityMeta:sendNetVar(key, receiver)

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

Sends a networked variable.

Parameters

  • key String

    Identifier of the networked variable

  • receiver Table default: nil

    The players to send the networked variable to

entityMeta:setNetVar(key, value, receiver)

Sets the value of a networked variable.

Parameters

  • key String

    Identifier of the networked variable

  • value

    New value to assign to the networked variable

  • receiver Table default: nil

    The players to send the networked variable to

Example Usage

client:setNetVar("example", "Hello World!")

See Also